package converter;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

import repository.AuctionRepository;
import domain.Auction;

@Component
public class AuctionConverter implements Converter<String, Auction>{
	
	private AuctionRepository auctionRepository;
	
	@Autowired
	public AuctionConverter(AuctionRepository auctionRepository) {
		this.auctionRepository = auctionRepository;
	}

	@Override
	public Auction convert(String source) {
		return auctionRepository.getAuction(Integer.valueOf(source));
	}

}
